<%@page import="com.richo.db.bean.Article"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/varlibs.jsp" %>
<%
	Article article = (Article)request.getAttribute("article");
%>
<!doctype html>
<html>
<head>
	<meta charset="UTF-8" />
	<title><%=_PAGE_TITLE %></title>
	<link rel="stylesheet" href="<%=request.getContextPath() %>/kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="<%=request.getContextPath() %>/kindeditor/plugins/code/prettify.css" />
	<script charset="UTF-8" src="<%=request.getContextPath() %>/kindeditor/kindeditor.js"></script>
	<script charset="UTF-8" src="<%=request.getContextPath() %>/kindeditor/lang/zh_CN.js"></script>
	<script charset="UTF-8" src="<%=request.getContextPath() %>/kindeditor/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content"]', {
				cssPath : '<%=request.getContextPath() %>/kindeditor/plugins/code/prettify.css',
				uploadJson : '<%=request.getContextPath() %>/kindeditor/jsp/upload_json.jsp',
				fileManagerJson : '<%=request.getContextPath() %>/kindeditor/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
</head>
<body>
	<form name="example" method="post" action="article_edit_do">
		<input type="text" name="title" size="100"  value="<%=article.getTitle()%>" />
		<input type="hidden" name="id" value="<%=article.getId()%>" />
		<textarea name="content" cols="150" rows="20" style="width:1000px;height:500px;visibility:hidden;"><%=htmlspecialchars(article.getContent())%></textarea>
		<br />
		<input type="submit" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter)
	</form>
</body>
</html>
<%!
private String htmlspecialchars(String str) {
	str = str.replaceAll("&", "&amp;");
	str = str.replaceAll("<", "&lt;");
	str = str.replaceAll(">", "&gt;");
	str = str.replaceAll("\"", "&quot;");
	return str;
}
%>